package org.dromara.autocode.domain.entity;

import com.alibaba.excel.annotation.ExcelProperty;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import jakarta.validation.constraints.NotBlank;
import jakarta.validation.constraints.NotNull;
import lombok.Data;
import lombok.EqualsAndHashCode;
import org.dromara.common.core.validate.AddGroup;
import org.dromara.common.core.validate.EditGroup;
import org.dromara.common.mybatis.core.domain.BaseEntity;

import java.io.Serial;

/**
 * 编码生成规则组成对象 sys_auto_code_part
 *
 * @author wenrui Su
 * @date 2025-03-19
 */
@Data
@EqualsAndHashCode(callSuper = true)
@TableName("sys_auto_code_part")
public class SysAutoCodePart extends BaseEntity {

  @Serial
  private static final long serialVersionUID=1L;


  @ExcelProperty(value = "分段ID")
  @NotNull(message = "分段ID不能为空", groups = { EditGroup.class })
  @TableId(value = "part_id")
  private Long partId;

  @ExcelProperty(value = "规则ID")
  @NotNull(message = "规则ID不能为空", groups = { AddGroup.class, EditGroup.class })
  private Long ruleId;

  @ExcelProperty(value = "分段序号")
  @NotNull(message = "分段序号不能为空", groups = { AddGroup.class, EditGroup.class })
  private Long partIndex;

  @ExcelProperty(value = "分段类型，INPUTCHAR：输入字符，NOWDATE：当前日期时间，FIXCHAR：固定字符，SERIALNO：流水号")
  @NotBlank(message = "分段类型，INPUTCHAR：输入字符，NOWDATE：当前日期时间，FIXCHAR：固定字符，SERIALNO：流水号不能为空", groups = { AddGroup.class, EditGroup.class })
  private String partType;

  @ExcelProperty(value = "分段编号")
  private String partCode;

  @ExcelProperty(value = "分段名称")
  private String partName;

  @ExcelProperty(value = "分段长度")
  @NotNull(message = "分段长度不能为空", groups = { AddGroup.class, EditGroup.class })
  private Long partLength;

  @ExcelProperty(value = "")
  private String dateFormat;

  @ExcelProperty(value = "输入字符")
  private String inputCharacter;

  @ExcelProperty(value = "固定字符")
  private String fixCharacter;

  @ExcelProperty(value = "流水号起始值")
  private Long seriaStartNo;

  @ExcelProperty(value = "流水号步长")
  private Long seriaStep;

  @ExcelProperty(value = "流水号当前值")
  private Long seriaNowNo;

  @ExcelProperty(value = "流水号是否循环")
  private String cycleFlag;

  @ExcelProperty(value = "循环方式，YEAR：按年，MONTH：按月，DAY：按天，HOUR：按小时，MINITE：按分钟，OTHER：按传入字符变")
  private String cycleMethod;

  @ExcelProperty(value = "备注")
  private String remark;

  @ExcelProperty(value = "预留字段1")
  private String attr1;

  @ExcelProperty(value = "预留字段2")
  private String attr2;

  @ExcelProperty(value = "预留字段3")
  private Long attr3;

  @ExcelProperty(value = "预留字段4")
  private Long attr4;
}
